#ifndef SINGLETON_H
#define SINGLETON_H

template <typename T>
class Singleton {
public:
    static T& instance() {
        static T i;
        return i;
    }

    // 禁用拷贝构造和赋值操作
    Singleton(Singleton const&) = delete;
    Singleton& operator=(Singleton const&) = delete;

protected:
    Singleton() = default;
    ~Singleton() = default;
};

#endif  // SINGLETON_H